package br.com.others.guj.model;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.ForeignKey;

@Entity
@Table(name = "LINK")
public class Link implements java.io.Serializable {

	private static final long serialVersionUID = -2439429883405985924L;

	@EmbeddedId
	private LinkPK id;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "connectionId", insertable = false, updatable = false)
	@ForeignKey(name = "FK_CONNECTION_ID")
	private Connection connection;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "dotId", insertable = false, updatable = false)
	@ForeignKey(name = "FK_DOTTO_ID")
	private Dot dotTo;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "dotId", insertable = false, updatable = false)
	@ForeignKey(name = "FK_DOTIDFROM_ID")
	private Dot dotIdFrom;

	/**
	 * @return the connection
	 */
	public Connection getConnection() {
		return connection;
	}

	/**
	 * @param connection
	 *            the connection to set
	 */
	public void setConnection(Connection connection) {
		this.connection = connection;
	}

	/**
	 * @return the id
	 */
	public LinkPK getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(LinkPK id) {
		this.id = id;
	}

	/**
	 * @return the dotTo
	 */
	public Dot getDotTo() {
		return dotTo;
	}

	/**
	 * @param dotTo
	 *            the dotTo to set
	 */
	public void setDotTo(Dot dotTo) {
		this.dotTo = dotTo;
	}

	/**
	 * @return the dotIdFrom
	 */
	public Dot getDotIdFrom() {
		return dotIdFrom;
	}

	/**
	 * @param dotIdFrom
	 *            the dotIdFrom to set
	 */
	public void setDotIdFrom(Dot dotIdFrom) {
		this.dotIdFrom = dotIdFrom;
	}
}
